import { createRequest } from '/@/api/service';
const module = 'ib/archive/police/v1/DossierManager/';

/**
 * @function 文件修改(重命名)
 * @param data
 * @param header
 * @returns
 */
function UPDATE_DOSSIER(
  data: DossierManager.DossierOperateReq,
  header: object = {},
): Promise<DossierManager.DossierOperateResp> {
  return createRequest(`${process.env.APP_API_URL}${module}updateDossier`, data, header, 'POST');
}

/**
 * @function 文件新增
 * @param data
 * @param header
 * @returns
 */
function INSERT_DOSSIER(
  data: DossierManager.DossierOperateReq,
  header: object = {},
): Promise<DossierManager.DossierOperateResp> {
  return createRequest(`${process.env.APP_API_URL}${module}insertDossier`, data, header, 'POST');
}

/**
 * @function 文件删除
 * @param data
 * @param header
 * @returns
 */
function DELETE_DOSSIER(
  data: DossierManager.DossierBaseReq,
  header: object = {},
): Promise<DossierManager.DossierBaseResp> {
  return createRequest(`${process.env.APP_API_URL}${module}deleteDossier`, data, header, 'POST');
}

/**
 * @function 文件夹修改(重命名)
 * @param data
 * @param header
 * @returns
 */
function UPDATE_DOSSIER_TYPE(
  data: DossierManager.DossierTypeOperateReq,
  header: object = {},
): Promise<DossierManager.DossierTypeOperateResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}updateDossierType`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 文件夹新增
 * @param data
 * @param header
 * @returns
 */
function INSERT_DOSSIER_TYPE(
  data: DossierManager.DossierTypeOperateReq,
  header: object = {},
): Promise<DossierManager.DossierTypeOperateResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}insertDossierType`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 文件夹删除
 * @param data
 * @param header
 * @returns
 */
function DELETE_DOSSIER_TYPE(
  data: DossierManager.DossierBaseReq,
  header: object = {},
): Promise<DossierManager.DossierBaseResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}deleteDossierType`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 档案查询——树
 * @param data
 * @param header
 * @returns
 */
function QUERY_DOSSIER_TREE(
  data: DossierManager.DossierTreeReq,
  header: object = {},
): Promise<DossierManager.DossierTreeResp> {
  return createRequest(`${process.env.APP_API_URL}${module}queryDossierTree`, data, header, 'POST');
}

/**
 * @function 档案查询——列表
 * @param data
 * @param header
 * @returns
 */
function QUERY_DOSSIER_LIST(
  data: DossierManager.DossierListReq,
  header: object = {},
): Promise<DossierManager.DossierListResp> {
  return createRequest(`${process.env.APP_API_URL}${module}queryDossierList`, data, header, 'POST');
}

export {
  UPDATE_DOSSIER,
  INSERT_DOSSIER,
  DELETE_DOSSIER,
  UPDATE_DOSSIER_TYPE,
  INSERT_DOSSIER_TYPE,
  DELETE_DOSSIER_TYPE,
  QUERY_DOSSIER_TREE,
  QUERY_DOSSIER_LIST,
};
